package com.jianglin.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jianglin.mapper.ComplaintTypeMapper;
import com.jianglin.model.ComplaintType;
import com.jianglin.service.IComplaintTypeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ComplaintTypeServiceImpl implements IComplaintTypeService {

    @Resource
    private ComplaintTypeMapper complaintTypeMapper;

    @Override
    public PageInfo<ComplaintType> findListByPage(Integer page, Integer pageSize) {
        PageHelper.startPage(page, pageSize);
        List<ComplaintType> list = complaintTypeMapper.findAll();
        return new PageInfo<>(list);
    }

    @Override
    public List<ComplaintType> queryType() {
        return complaintTypeMapper.findAll();
    }

    @Override
    public int add(ComplaintType complaintType) {
        return complaintTypeMapper.insert(complaintType);
    }

    @Override
    public int delete(Integer id) {
        return complaintTypeMapper.delete(id);
    }

    @Override
    public int updateData(ComplaintType complaintType) {
        return complaintTypeMapper.update(complaintType);
    }

    @Override
    public ComplaintType findById(Integer id) {
        return complaintTypeMapper.findById(id);
    }}
